package cn.well.cloud.exception;

import lombok.Data;
import cn.hutool.core.util.StrUtil;
import cn.well.cloud.exception.enums.BizExceptionEnum;


/**
 * 参数为空异常类
 * Created by wison on 2019年8月23日.
 *
 */
@Data
public class ParamIsNullException extends RuntimeException {
    
    private Integer code;
    
    private final String parameterName;
    private final String parameterType;

    public ParamIsNullException(String parameterName, String parameterType) {
        super("");
        this.parameterName = parameterName;
        this.parameterType = parameterType;
        this.code = BizExceptionEnum.PARAM_MISS.getCode();
    }

    
    @Override
    public String getMessage() {
        return  StrUtil.format(BizExceptionEnum.PARAM_MISS.getMessage(), this.parameterType,this.parameterName);
    }

    public final String getParameterName() {
        return this.parameterName;
    }

    public final String getParameterType() {
        return this.parameterType;
    }
}